package com.ss.android.article.browser.database.bookmark;

import android.database.Cursor;
import android.support.annotation.NonNull;
import com.a.a.NightMode;
import com.a.a.u;
import com.ss.android.article.browser.database.BrowserHistory;

public final class h implements NightMode {
    private final a b;
    private final BrowserHistory a;

    public h(a arg1, BrowserHistory arg2) {
        this.b = arg1;
        this.a = arg2;

    }

    public final void f(@NonNull Object arg6) {
        Object v1;
        boolean v0_2;
        Object v0_1;
        Cursor v0 = com.ss.android.article.browser.database.bookmark.a.a(this.b, this.a.url);
        if(v0.moveToFirst()) {
            v0.close();
            v0_1 = arg6;
            v1 = v0_1;
            v0_2 = false;
        }
        else {
            v0.close();
            if(com.ss.android.article.browser.database.bookmark.a.a(this.b).insert("bookmark", null, com.ss.android.article.browser.database.bookmark.a.b(this.a)) != -1) {
                v0_2 = true;
                v1 = arg6;
            }
            else {
                v0_1 = arg6;
                v1 = v0_1;
                v0_2 = false;
            }
        }

        ((u)v1).onItem(Boolean.valueOf(v0_2));
        ((u)arg6).onComplete();
    }
}

